public class Stack {
    public static void main(String[] args) {
        //定义栈
        java.util.Stack<Integer> stack = new java.util.Stack<>();

        //进栈
        stack.push(1);
        stack.push(2);

        //出栈
        int ret = stack.pop();
        System.out.println(ret);

        //查看栈顶元素
        ret = stack.peek();
        System.out.println(ret);
    }
}
